<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title>商城抽奖活动</title>
    <style>
        *{
            margin:0px;
            padding: 0px;;
        }
        .bg{
            width: 1349px;
            height: 670px;
            margin: auto;
            /*border: 1px solid red;*/
            overflow: hidden;
        }
        img{
            width: 1349px;
        }
        button{
            position: absolute;
            top: 480px;
            left: 800px;
            z-index: 30;
            width: 100px;
            height: 30px;
            outline: none;
            background-color: #b81c22;
            border: none;
            line-height: 30px;
            text-align: center;
            color: white;
            cursor: pointer;
        }
        button:hover{
            background-color: white;
            color: black;
            border: 1px solid #ffef00;
        }
        .actives{
            /*width: 500px;*/
            height: 100px;
            /*border: 1px solid red;*/
            position: absolute;
            top: 370px;
            left: 400px;
            text-align: center;
            line-height: 100px;
        }
        .actives p{
            font-size: 35px;
            font-weight: bold;
            /*font-family: '汉仪南宫体简';*/
        }
    </style>
</head>
<body>
<div class="actives">
    <p>距离活动结束还有<span id="my_time"></span></p>
</div>
<div class="bg">
    <img src="../images/bg1.png" alt="抽奖图片"/>
    <button id="btnclick">点击了解详情</button>
</div>
<script>
    var btnclick = document.getElementById("btnclick");
    btnclick.onclick = function(){
        location.href = "../page/game.html";
    }
    window.onload = function(){
        showTime();
    }
   function showTime(){
       var my_time = document.getElementById("my_time");
       var endtime = new Date("2016,7,15,23:59:59");//设置限时抽奖结束的时间
       var mytime = new Date();
       var lefttime = parseInt((endtime.getTime()-mytime.getTime())/1000);//获取到结束时间距离现在的时间差（秒）
       var day = parseInt(lefttime/(60*60*24));//得到天数（秒---day）
       var h = parseInt(lefttime/(60*60)%24);//得到小时
       var m = parseInt(lefttime/60%60);//得到分钟
       var s = parseInt(lefttime%60);//得到分钟
       my_time.innerHTML = day + "天" +h +"小时" + m +"分" + s + "秒";
       if(lefttime <= 0 ){
           my_time.innerHTML = "抱歉，限时抽奖活动已经结束了！！";
           clearInterval(setTimeout(showTime,500));
       }
       setTimeout(showTime,500);
   }
</script>
</body>
</html>